<?php
namespace app\user\controller;

use app\common\controller\UserBase;
use app\user\model\Notice as NoticeModel;

class Notice extends UserBase
{
    protected $noAuth = ['message'];
    //消息通知业
    public function message()
    {
        $today = NoticeModel::whereDay('datetime')->where('status','0')->select();
        $list = NoticeModel::where('status','0')->select();
        return $this->fetch('message', ['today' => $today,'list'=>$list]);
    }
    //通知详情
    public function detail($id)
    {
        $data = NoticeModel::where('id',$id)->find();
        NoticeModel::where('id',$id)->update(['status'=>'1']);
        //判断是否CRM模块
        if($data['type'] == '1'){
            $this->redirect(url('crm/detail/index',['id'=>$data['data']['customer_id'],'show'=>$data['data']['show']]));
        }
        //return $this->fetch('detail');
    }
    
}
